<#--VXE-GRID-VUE-->
<vxe-grid  v-bind="gridOptions.gridProps"  ref="${pTable.beanName}Grid"  @sortChange="($event:any)=>gridOptions.changeSort($event)">
    <template #toolbar_buttons>
      <el-space size="large">
<#list pTableConfig.queryColumns as queryColumn>
      <query-field :filter-column="${queryColumn.varName}ColumnFilter" @change="get${pTable.className}List"/> <!-- ${queryColumn.columnCaption!''} 查询条件 -->
</#list>
      <#if pTableConfig.useRecurseQuery==true><el-checkbox v-model="onlyDirectly${pTable.className}" border size="medium" @change="get${pTable.className}List">只看直属${pTable.tableCaption!}</el-checkbox></#if>
      <el-space size="small">
<#if pTableConfig.queryColumns?size gt 0>
      <el-button type="primary" @click="get${pTable.className}List" :icon="Search" size="medium">查询</el-button>
      <el-button @click="resetQueryFilters" :icon="Reset" size="medium">重置</el-button>
</#if>
<#if dataGrid.toolbarAddBtn!false == true>
      <dayu-auth-button @click="add${pTable.className}BtnClick" :icon="Plus" size="medium" :authTag="actionState.authTag" :lockState="actionState.masterLockState" :masterLockState="actionState.masterLockState">新增</dayu-auth-button>
</#if>
<#if dataGrid.toolbarEditBtn!false == true>
      <dayu-auth-button @click="edit${pTable.className}ToolBtnClick" :icon="Edit" size="medium" :authTag="actionState.authTag" :lockState="actionState.masterLockState" :masterLockState="actionState.masterLockState">编辑</dayu-auth-button>
</#if>
<#if dataGrid.toolbarDelBtn!false == true>
      <dayu-auth-button @click="del${pTable.className}ToolBtnClick" :icon="Delete" size="medium" :authTag="actionState.authTag" :lockState="actionState.masterLockState" :masterLockState="actionState.masterLockState">删除</dayu-auth-button>
</#if>
<#if dataGrid.toolbarExpBtn!false == true>
      <el-button @click="export${pTable.className}BtnClick" :icon="Export" size="medium">导出</el-button>
</#if>
      </el-space>
<#if pTable.isLockByMaster>
      <dayu-data-lock :masterLockState="0" v-model:lockState="actionState.masterLockState" :authTag="actionState.authTag" :onChangeState="masterLockStateChange"/><!-- 按master进行锁定时，必须满足1：对整表数据锁定， 或者2：查询条件必须选择一条主表数据 -->
</#if>
      </el-space>
    </template>

    <template #top>
      <div class="grid-stats"><!-- 统计数据栏 -->
        <el-space>
          <InfoFilled twoToneColor="#1890FF" style="padding-left: 5px;"/>
          <span>共查询到 {{gridOptions.pager.totalRows}} 条记录</span>
          <#-- 自动生成时值考虑没有group by字段时的统计值，对使用group by column的情况，需要手动处理-->
          <#-- 对每一个数值字段，按每个聚合函数显示 -->
          <#list pTableConfig.aggregateSrcColumns as aggSrcColumn><#-- 有聚合函数的原始字段 -->          
          <div class="v-divider-w1" style="height:30px"></div>          
          <span>${aggSrcColumn.columnCaption!''}：</span>
            <#list aggSrcColumn.aggregateColumns as aggColumn>
          <span>${aggColumn.columnCaption!''}：<el-tag color="#e62" style="color:#fff; font-weight: bold;">{{ statData.total.${aggColumn.varName} || 0 }}</el-tag>${aggSrcColumn.unit!''}</span><#sep>，<#sep>
            </#list>
          </#list>
        </el-space>
      </div>
    </template>
<#if dataGrid.pagination!false == true>
    <template #pager>
      <dayu-pager :pager="gridOptions.pager" @change="onPagerChange"></dayu-pager>
    </template>
</#if>
<#list pTableConfig.gridColumns as col>
<#if (col.codeType!'')?length gt 0>
    <template #${col.varName}Column="{ row }">  <!-- ${col.columnCaption} 字段自定义显示 -->
      <dayu-dropdown :row=row labelProp="${col.varName}Caption" valueProp="${col.varName}" <#if col.editMenu!false==true>:options="${col.varName}Items" @change="change${col.propName}" :authTag="actionState.authTag" :lockState="row.rowLock" :masterLockState="actionState.masterLockState"</#if>></dayu-dropdown>
    </template>
</#if>
</#list>
<#if dataGrid.hasOptColumn==true>
    <template #operationColumn="{ row }">
      <el-space size="small" class="operationColumn">
      <#assign opColWidth=30>
      <#if dataGrid.optrCellFileBtn!false == true>
        <#assign opColWidth+=40>
        <el-button type="text" size="small" :auto-insert-space="false">附件</el-button>
      </#if>
      <#if dataGrid.optrCellInfoBtn!false == true>
        <#assign opColWidth+=40>
        <el-button type="text" size="small" :auto-insert-space="false">详情</el-button>
      </#if>
      <#if dataGrid.optrCellEditBtn!false == true>
        <#assign opColWidth+=60>
        <dayu-auth-button @click="edit${pTable.className}BtnClick(row.${pTable.idVarName})" type="primary" size="mini" :icon="Edit" plain :authTag="actionState.authTag" :lockState="row.rowLock" :masterLockState="actionState.masterLockState">编辑</dayu-auth-button>
      </#if>
      <#if dataGrid.optrCellDelBtn!false ==  true>
        <#assign opColWidth+=60>
        <dayu-auth-button @click="delete${pTable.className}BtnClick(row.${pTable.idVarName}, row.${pTable.nameVarName})" type="danger" size="mini" :icon="Delete" plain :authTag="actionState.authTag" :lockState="row.rowLock" :masterLockState="actionState.masterLockState">删除</dayu-auth-button>
      </#if>
      <#if pTable.isLockByRow>
        <#assign opColWidth+=90>
        <dayu-data-lock :onChangeState="${pTable.beanName}RowLockStateChange" size="mini" :dataId="row.id" :authTag="actionState.authTag" :masterLockState="actionState.masterLockState" v-model:lockState="row.rowLock"/>
      </#if>
      </el-space>
    </template>
</#if>
  </vxe-grid>